--Initial campaign triggers (static file, not updated)
--Copied to Status/camp_triggers.lua in first mission and subsequently read and updated there
--Campaign triggers are defined with conditions and actions
-------------------------------------------------------------------------------------------------------

--List of Return functions to build conditions:
--Return.Time()							returns time of day in seconds
--Return.Day()							returns day of month
--Return.Month()						returns month as number
--Return.Year()							returns year as number
--Return.Mission()						returns campaign mission number
--Return.CampFlag(flag-n)				returns value of campaign flag
--Return.AirUnitActive("UnitName")		returned boolean whether the air unit is active			
--Return.AirUnitReady("UnitName")		returns amount of ready aircraft in unit
--Return.AirUnitAlive("UnitName")		returns amount of ready and damaged aircraft in unit
--Return.AirUnitBase("UnitName")		returns the name of the airbase the unit operats from
--Return.AirUnitPlayer("UnitName")		returns boolean whether the air units is playable
--Return.TargetAlive("TargetName")		returns percentage of alive sub elements in target
--Return.GroupHidden("GroupName")		returns group hidden status
--Return.GroupProbability("GroupName")	returns group spawn probability value between 0 and 1

--List of Action functions for trigger actions:
--Action.None()
--Action.Text("your briefing text")
--Action.SetCampFlag(flag-n, boolean/number)
--Action.AddCampFlag(flag-n, number)
--Action.AddImage("filname.jpg")
--Action.CampaignEnd("win"/"draw"/"loss")
--Action.TargetActive("TargetName", boolean)
--Action.AirUnitActive("UnitName", boolean)
--Action.AirUnitBase("UnitName", "BaseName")
--Action.AirUnitPlayer("UnitName", boolean)
--Action.AirUnitReinforce("SourceUnitName", "DestinationUnitName", destNumber)
--Action.AirUnitRepair()
--Action.AddGroundTargetIntel("sideName")
--Action.GroupHidden("GroupName", boolean)
--Action.GroupProbability("GroupName", number 0-1)

--Important notes:
--for condition and action strings: outside with single quotes '', inside with double quotes ""!

camp_triggers = {
	
	----- CAMPAIGN INTRO ----
	["Campaign Briefing"] = {										--Trigger name
		active = true,												--Trigger is active
		once = true,												--Trigger is fired once
		condition = 'true',											--Condition of the trigger to return true or false embedded as string
		action = {													--Trigger action function embedded as string
			[1] = 'Action.Text("Welcome to Gerogia and 1 Squadron Sir. Im sure youve been fully briefed but to recap Russia has attacked Tbilissi and NATO has decided to step in. The goal is to cripple Russians bases north of Tbilissi and stop the attack.")',
			[2] = 'Action.Text("NATO has sent considerable forces to Georgia in support of the operation. Together with the Tornados of 617 Squadron and Geogias SU25s we will be conducting strike and SEAD operations.  The Canadians, Dutch, Germans and Swedes have also supplied offensive aircraft and personel.  1/12 Cambresis Squadron equipped with Mirage 2000C and F14s of the USN will provide CAP and fighter escort while air to air refulling will be provided by RAF 10 Squadron and the USAF.  The USAF have also supplied the E-3A Sentry from the 7th Airborne Command and Control Squadron.")',
			[3] = 'Action.Text("The Russian Air Force is flying a mix of MiG-29, MiG-23 with Su-25T and 24s as ground attack. Air bases and target complexes of high value are protected by a variety of surface-air missile systems, such as the SA-6 Gainful, the SA-8 Gecko and the SA-3 Goa, as well as short-range IR-SAMs and AAA. As part of the coalition air offensive, NATO is tasked with neutralizing the Russian Air Force, both in the air and on the ground, as well as destroying Russian airbases.")',
			[4] = 'Action.Text("The Bullseye Coordinates are N 43 11.65 et E 044 31.81.")',
			[5] = 'Action.AddImage("Newspaper_FirstNight.jpg")',
		},
	},
	
	
	----- CAMPAIGN END -----
	["Campaign End Victory 1"] = {
		active = true,
		once = true,
		condition = 'GroundTarget["blue"].percent < 40',
		action = {
			[1] = 'Action.CampaignEnd("win")',
			[2] = 'Action.Text("The Allied units deployed to Georgia have successfully destroyed all the targets that they were assigned by US Central Command with the precious help of the French fighters. With the complete destruction of the Russian airbases, the air campaign of this war comes to an end. Allied air power has once again proven its effectiveness and decisiveness. Well done.")',
			[3] = 'Action.AddImage("Newspaper_Victory.jpg")',
			[4] = 'NoMoreNewspaper = true',
		},
	},
	["Campaign End Victory 2"] = {
		active = true,
		once = true,
		condition = 'Return.AirUnitReady("1./14.IAP") + Return.AirUnitReady("790.IAP") + Return.AirUnitReady("1./19.IAP") + Return.AirUnitReady("2./19.IAP") + Return.AirUnitReady("1./17.IAP") + Return.AirUnitReady("1./31.IAP") + Return.AirUnitReady("1./41.IAP") < 1',
		action = {
			[1] = 'Action.CampaignEnd("win")',
			[2] = 'Action.Text("The Russian Air Force is in ruins. After repeated air strikes and disastrous losses in air-air combat, the Russians are no longer able to produce any sorties or offer any resistance. The NATO now owns complete air superiority. With the disappearance of the air threat, the role of 1 Squadron in this war comes to an end.")',
			[3] = 'Action.AddImage("Newspaper_Victory.jpg")',
			[4] = 'NoMoreNewspaper = true',
		},
	},
	["Campaign End Loss"] = {
		active = true,
		once = true,
		condition = 'Return.AirUnitAlive("1 SQN RAF") + Return.AirUnitReady("R/1 SQN RAF") < 2',
		action = {
			[1] = 'Action.CampaignEnd("loss")',
			[2] = 'Action.Text("Ongoing combat operations have exhausted 1 SQN RAF. Loss rate has reached a level where reinforcements are no longer able to sustain combat operations. With the failure of Allied Air Force to attain air superiority, RAF Command has decided to call of the air campaign against the Russians. Without destroying Russians airbases it seems unlikely that the coalition will be able to win this war.")',
			[3] = 'Action.AddImage("Newspaper_Defeat.jpg")',
			[4] = 'NoMoreNewspaper = true',
		},
	},
--[[	["Campaign End Loss 2"] = {
		active = true,
		once = true,
		condition = 'Return.TargetAlive("CVN-74 John C. Stennis") == 0',
		action = {
			[1] = 'Action.CampaignEnd("loss")',
			[2] = 'Action.Text("After the CVN-74 John C. Stennis has been hit by air strikes and sunk, VFA-131 is no longer able to fly. Most of its planes are deep into the Caucasian waters and it will need a long time to restore this unit s capabilities. Other US units will have to continue the fight without the VFA-131 support. This is a bitter failure for the Navy")',
			[3] = 'Action.AddImage("Newspaper_Defeat.jpg")',
			[4] = 'NoMoreNewspaper = true',
		},
	},	]]--
	["Campaign End Draw"] = {
		active = true,
		once = true,
		condition = 'MissionInstance == 40',
		action = {
			[1] = 'Action.CampaignEnd("draw")',
			[2] = 'Action.Text("The air campaign has seen a sustained period of inactivity. Seemingly unable to complete the destruction of the Russian Air Force and infrastructure, Allied Central Command has called off all squadrons from offensive operations. We hope negociations with Russians will convince them to stop attacks in Georgia")',
			[3] = 'NoMoreNewspaper = true',
		},
	},


	----- AIRBASE STRIKES -----
	["Beslan Airbase Disabled"] = {
		active = true,
		condition = 'Return.TargetAlive("Beslan Airbase") == 0',
		action = {
			[1] = 'db_airbases["Beslan"].inactive = true',
		}
	},
	["Beslan Airbase Disabled Text"] = {
		active = true,
		once = true,
		condition = 'Return.TargetAlive("Beslan Airbase") == 0',
		action = {
			[1] = 'Action.Text("After the facilities at Beslan Airbase have been hit by air strikes, air operations at this base came to a complete stop. Intelligence believes that due to the heavy damage inflicted, the base is no longer ably to produce any aviation sorties.")',
--[[		[2] = 'Action.AddImage("BDA_Beatty.jpg")', ]]--  ---A changer
		}
	},
	["Nalchik Airbase Disabled"] = {
		active = true,
		condition = 'Return.TargetAlive("Nalchik Airbase") == 0',
		action = {
			[1] = 'db_airbases["Nalchik"].inactive = true',
		}
	},
	["Nalchik Airbase Disabled Text"] = {
		active = true,
		once = true,
		condition = 'Return.TargetAlive("Nalchik Airbase") == 0',
		action = {
			[1] = 'Action.Text("The infrastructure at Nalchik Airbase has been destroyed by air strikes. Flying operations at this base have ceased completely and are unlikely to resume. This will ease our efforts to hit other targets in the Nalchik Country area.")',
--[[		[2] = 'Action.AddImage("BDA_Lincoln.jpg")', ]]--  ---A changer
		}
	},
	["Mozdok Airbase Disabled"] = {
		active = true,
		condition = 'Return.TargetAlive("Mozdok Airbase") == 0',
		action = {
			[1] = 'db_airbases["Mozdok"].inactive = true',
		}
	},
	["Mozdok Airbase Disabled Text"] = {
		active = true,
		once = true,
		condition = 'Return.TargetAlive("Mozdok Airbase") == 0',
		action = {
			[1] = 'Action.Text("Recent air strikes have destroyed enemy ground elements running operations at Mozdok Airbase. Without their ground support, any remaining aircraft at the airstrip will no longer be able to launch on sorties.")',
		}
	},
	["Mineralnye Vody Airbase Disabled"] = {
		active = true,
		condition = 'Return.TargetAlive("Mineralnye-Vody Airbase") == 0',
		action = {
			[1] = 'db_airbases["Mineralnye-Vody"].inactive = true',
		}
	},
	["Mineralnye Vody Airbase Disable Text"] = {
		active = true,
		once = true,
		condition = 'Return.TargetAlive("Mineralnye-Vody Airbase") == 0',
		action = {
			[1] = 'Action.Text("Thanks to the destruction of the fuel and ammunition stocks at Mineralnye Vody Airbase, air operations at that base have come to a complete halt. Intelligence estimates that interceptors at Mineralnye Vody Airbase no longer pose a threat to allied strike aircraft. This will considerably ease our access to targets in the enemy rear area.")',
--[[		[2] = 'Action.AddImage("BDA_Creech.jpg")', ]]-- ---A changer
		}
	},
	["CVN-74 John C. Stennis sunk"] = {
		active = true,
		condition = 'Return.TargetAlive("CVN-74 John C. Stennis") == 0',
		action = {
			[1] = 'db_airbases["Stennis"].inactive = true',
			[2] = 'Action.Text("After the CVN-74 John C. Stennis has been hit by air strikes and sunk, VFA-131 is no longer able to fly. Most of its planes are deep into the sea and it will need a long time to restore this unit s capabilities")',			
		}
	},
	["CVN-70 Carl Vinson"] = {
		active = true,
		condition = 'Return.TargetAlive("CVN-70 Carl Vinson") == 0',
		action = {
			[1] = 'db_airbases["Carl Vinson"].inactive = true',
			[2] = 'Action.Text("After the CVN-70 Carl Vinson has been hit by air strikes and sunk, VF-101 is no longer able to fly. Most of its planes are deep into the sea and it will need a long time to restore this unit s capabilities")',			
		}
	},	
	
	----- RED CAP -----
	["CAP After EWR Destroyed"] = {
		active = true,
		once = true,
		condition = 'Return.TargetAlive("102 EWR Site") == 0 and Return.TargetAlive("103 EWR Site") == 0 and Return.TargetAlive("101 EWR Site") == 0',
		action = {
			[1] = 'Action.TargetActive("CAP Beslan", true)',
			[2] = 'Action.TargetActive("CAP Mozdok", true)',
			[3] = 'Action.TargetActive("CAP Nalchik", true)',
			[4] = 'Action.TargetActive("CAP Mineralnye-Vody", true)',
			[5] = 'Action.TargetActive("CAP Center", true)',
			[6] = 'Action.Text("With the recent destruction of all Early Warning Radar sites in the operations area, the ability of the enemy to launch interceptors against our strike packages was severely degraded. Intelligence expects that the enemy will increasingly depend on Combat Air Patrols to compensate, though without the support of ground controllers these are estimated to be of limited effectiveness.")',
		},
	},		
	
	----- REPAIR AND REINFORCEMENTS -----
	["Repair"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitRepair()',
	},
	["Reinforce EC 1/12"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("EC 2/12", "EC 1/12", 6)',
	},
	["Reinforce 18 SQN RAF"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("R/18 SQN RAF", "18 SQN RAF", 2)',
	},	
	["Reinforce 313 SQN RNLAF"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("R/313 SQN RNLAF", "313 SQN RNLAF", 6)',
	},
	["Reinforce 10 SQN RAF"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("R/10 SQN RAF", "10 SQN RAF", 2)',
	},
	["Reinforce 174 ARW USAF"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("R/174 ARW USAF", "174 ARW USAF", 2)',
	},	
	["Reinforce 409 SQN RCAF"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("R/409 SQN RCAF", "409 SQN RCAF", 6)',
	},
	["Reinforce VF-101 USN"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("R/VF-101 USN", "VF-101 USN", 4)',
	},
	["Reinforce 1./14.IAP"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("2./14.IAP", "1./14.IAP", 6)',
	},
	["Reinforce 1./19.IAP"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("3./19.IAP", "1./19.IAP", 6)',
	},
	["Reinforce 1./17.IAP"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("2./17.IAP", "1./17.IAP", 6)',
	},
	["Reinforce 1./31.IAP"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("3./31.IAP", "1./31.IAP", 8)',
	},
	["Reinforce 1./41.IAP"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("R./41.IAP", "1./41.IAP", 6)',
	},
	["Reinforce 1./61.IAP"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("R./61.IAP", "1./61.IAP", 4)',
	},
	["Reinforce 1./81.IAP"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("R./81.IAP", "1./81.IAP", 6)',
	},	
	["Reinforce Georgian AF1"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("R/Georgian AF1", "Georgian AF1", 6)',
	},	
	["Reinforce Georgian AF2"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("R/Georgian AF2", "Georgian AF2", 6)',
	},	
	["Reinforce 1 SQN RAF"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("R/1 SQN RAF", "1 SQN RAF", 6)',
	},	
	["Reinforce 617 SQN RAF"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("R/617 SQN RAF", "617 SQN RAF", 6)',
	},	
	["Reinforce jagdbombergeschwader 32"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("R/jagdbombergeschwader 32", "jagdbombergeschwader 32", 6)',
	},	
	["Reinforce 24 SQN RAF"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("R/24 SQN RAF", "24 SQN RAF", 1)',
	},	
	["Reinforce EC 2/5"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("R/EC 2/5", "EC 2/5", 6)',
	},	
	----- AVIATION UNIT STATUS -----
	["1 SQN RAF Alive 75%"] = {
		active = true,
		once = true,
		condition = 'Return.AirUnitAlive("1 SQN RAF") < 3',
		action = 'Action.Text("Aircraft strength of 1 SQN RAF equiped with the Harrier has fallen below 75%.")',
	},
	["1 SQN RAF Alive 50%"] = {
		active = true,
		once = true,
		condition = 'Return.AirUnitAlive("1 SQN RAF") < 2',
		action = 'Action.Text("Aircraft strength of 1 SQN RAF equiped with the Harrier has fallen below 50%. If losses continue at the present rate, the combat capability of the squadron is in jeopardy.")',
	},
	["1 SQN RAF Alive 25%"] = {
		active = true,
		once = true,
		condition = 'Return.AirUnitAlive("1 SQN RAF") < 1',
		action = 'Action.Text("Aircraft strength of 1 SQN RAF equiped with the Harrier has fallen below 25%. The number of available airframes is critically low. The squadron is short of destruction.")',
	},
	["Newspaper Nighthawk Down"] = {
		active = true,
		once = true,
		condition = 'Return.AirUnitAlive("F10") < 2',
		action = {
			[1] = 'Action.AddImage("GR7.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	
	
	---- GROUND TARGET STATUS ---
	["Blue Ground Target Briefing Intel"] = {
		active = true,
		condition = 'true',
		action = 'Action.AddGroundTargetIntel("blue")',
	},
	["Red Ground Target Briefing Intel"] = {
		active = true,
		condition = 'true',
		action = 'Action.AddGroundTargetIntel("red")',
	},
	
	
	---- NEWSPAPER ----
--[[	["Intel Frontline"] = {
		active = true,
		once = true,
		condition = 'Return.Mission() > 6',
		action = {
			[1] = 'Action.AddImage("Frontline.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Intel Beslan Airbase Intel"] = {
		active = true,
		once = true,
		condition = 'Return.Mission() > 5',
		action = {
			[1] = 'Action.AddImage("BeslanAirbaseIntel.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Intel Nalchik Airbase Intel"] = {
		active = true,
		once = true,
		condition = 'Return.Mission() > 4',
		action = {
			[1] = 'Action.AddImage("NalchikAirbaseIntel.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Intel Mineralnye-Vody Airbase Intel"] = {
		active = true,
		once = true,
		condition = 'Return.Mission() > 3',
		action = {
			[1] = 'Action.AddImage("MineralnyeAirbaseIntel.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},	
	["Intel Mozdok Airbase Intel"] = {
		active = true,
		once = true,
		condition = 'Return.Mission() > 2',
		action = {
			[1] = 'Action.AddImage("MozdokAirbaseIntel.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},	
	["Intel Elint Station Intel"] = {
		active = true,
		once = true,
		condition = 'Return.Mission() > 1',
		action = {
			[1] = 'Action.AddImage("ElintStationIntel.jpg")',
			[2] = 'NoMoreNewspaper = true',
			},
	},  ]]--
	["Newspaper AWACS"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_AWACS.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Eagle"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_Eagle.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Falcon"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_Falcon.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Foxbat"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_Foxbat.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Fulcrum"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_Fulcrum.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Gainful"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_Gainful.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Gecko"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_Gecko.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Nighthawk"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_Nighthawk.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Strike Eagle"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_StrikeEagle.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
}